/**
 * Created by sun on 2015/3/12.
 */
package com.jbm.jbmsupplier.util;
import org.apache.mina.core.session.IoSession;
import org.apache.mina.filter.codec.ProtocolCodecFactory;
import org.apache.mina.filter.codec.ProtocolDecoder;
import org.apache.mina.filter.codec.ProtocolEncoder;

public class OHCodeFactory implements ProtocolCodecFactory {
    private final OHEncoder encoder; // 编码
    private final OHDecoder decoder; // 解码

    public OHCodeFactory(String charset) {
        encoder = new OHEncoder(charset);
        decoder = new OHDecoder(charset);
    }

    public ProtocolEncoder getEncoder(IoSession session) {
        return encoder;
    }

    public ProtocolDecoder getDecoder(IoSession session) {
        return decoder;
    }
}